import { PartialType } from '@nestjs/mapped-types';
import { IsNotEmpty, IsNumber, IsOptional, IsString } from 'class-validator';

export class CreateCategoryDto {
  @IsNotEmpty({ message: '分类名称不得为空' })
  @IsString()
  name: string;

  @IsString()
  @IsOptional()
  categoryImg?: string;

  @IsOptional()
  parentId?: number | null;
}

export class UpdateCategoryDto extends PartialType(CreateCategoryDto) {
  @IsNotEmpty({ message: 'id不得为空' })
  @IsNumber()
  id: number;
}
